home *** CD-ROM | disk | FTP | other *** search
Wrap
/* ** $VER: Adjust 1.21, IE Arexx script ** Image Engineer Macro script ** Copyright © by Patrik M Nydensten ** 15/1 1997 Stockholm/Sweden ** ** Support for saving last used results added by MS ** ** Adjust slices in image vertically or horizontally. */ Options results signal on error NL = "0a"x if arg()==0 then exit pic=arg(1) PROJECT_INFO pic WIDTH picwidth=result PROJECT_INFO pic HEIGHT picheight=result PROJECT_INFO pic ZOOM origzoomval=result /* Get info from user */ if exists("ie:prefs/veadjust.cfg") == "1" then do call open("temp","ie:prefs/veadjust.cfg","R") values=readln("temp") parse var values ok dir adjh swidth adjv sheight . call close("temp") end else do dir=0 adjh=10 swidth=20 adjv=10 sheight=20 end 'FORM "Adjust" "Ok|Cancel"', 'RADIO,"Direction","Horizontally (Up & Down)|Vertically (Left & Right)|Both (First Horiz. then Vert.)|Both (First Vert. then Horiz.)",'dir'', 'INTEGER,"Slice adjustment (Horiz)",1,'picheight','adjh',SLIDER', 'INTEGER,"Slice width (Horiz)",1,'trunc(picwidth/2)','swidth',SLIDER', 'INTEGER,"Slice adjustment (Vert)",1,'picwidth','adjv',SLIDER', 'INTEGER,"Slice width (Vert)",1,'trunc(picheight/2)','sheight',SLIDER' values=result parse var values ok dir adjh swidth adjv sheight . if ok = 0 then exit call open("temp","ie:prefs/veadjust.cfg","W") res=writeln("temp",values) call close("temp") /* Let's go */ 'BRIGHTNESS' pic '-255' 'INTENSITY' /* Black image */ if RC==5 then exit AdjImage = RESULT OrgImage = pic UoD = -1 if dir==0 then call horiz() if dir==1 then call vert() if dir==2 then call horiz() if dir==3 then call vert() if (dir==2|dir==3) then do OrgImage = AdjImage 'BRIGHTNESS' pic '-255' 'INTENSITY' /* Black image */ AdjImage = Result end if dir==2 then call vert() if dir==3 then call horiz() if (dir==2|dir==3) then 'CLOSE' OrgImage exit horiz: do X = 0 to (picwidth+swidth) by swidth BX = X ; BY = 0 ; BEX = (X+swidth-1) ; BEY = (picheight-1) if X >= picwidth then leave if (X+swidth) > (picwidth-1) then BEX = (picwidth-1) 'CROP' OrgImage BX BY BEX BEY CropImage=RESULT 'MARK' CropImage 'PRIMARY' 'MARK' AdjImage 'SECONDARY' 'COMPOSITE' X (trunc(adjh/2)*UoD) 'MIX 100' Out = RESULT ; 'CLOSE' AdjImage ; 'CLOSE' CropImage ; AdjImage = Out if UoD = 1 then UoD = -1 else UoD = 1 end return 'OK' vert: do Y = 0 to (picheight+sheight) by sheight BX = 0 ; BY = Y ; BEX = (picwidth-1) ; BEY = (Y+sheight-1) if Y >= picheight then leave if (Y+sheight) > (picheight-1) then BEY = (picheight-1) 'CROP' OrgImage BX BY BEX BEY CropImage=RESULT 'MARK' CropImage 'PRIMARY' 'MARK' AdjImage 'SECONDARY' 'COMPOSITE' (trunc(adjv/2)*UoD) Y 'MIX 100' Out = RESULT ; 'CLOSE' AdjImage ; 'CLOSE' CropImage ; AdjImage = Out if UoD == 1 then UoD = -1 else UoD = 1 end return 'OK' /*******************************************************************/ /* This is where control goes when an error code is returned by IE */ /* It puts up a message saying what happened and on which line */ /*******************************************************************/ error: if RC=5 then do IE_TO_FRONT LAST_ERROR 'REQUEST "'||RESULT||'"' exit end else do IE_TO_FRONT LAST_ERROR 'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' ' OK ' exit end